package DAO;

import Interfaces.IStoreEntry_Dao;
import Models.StoreEntry;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class StoreEntry_Dao implements IStoreEntry_Dao {

        @Override
        public StoreEntry makeStoreEntry(String StoreName, String Address, String City, String StorePhone, String Floors, String Seats, String Parking, String ParkingSpots, String DaysOpen) throws IllegalArgumentException {

        Connection conn = null;
        PreparedStatement pst = null;
            try {
                conn = javaconnect.connectDB();
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(StoreEntry_Dao.class.getName()).log(Level.SEVERE, null, ex);
            }
        try {
            String query = "INSERT INTO stores (storename , address , city , storephone , floors , seats , parking , parkingspots , daysopen) value (?,?,?,?,?,?,?,?,?)";
            pst = conn.prepareStatement(query);
            pst.setString(1, StoreName);
            pst.setString(2, Address);
            pst.setString(3, City);
            pst.setString(4, StorePhone);
            pst.setString(5, Floors);
            pst.setString(6, Seats);
            pst.setString(7, Parking);
            pst.setString(8, ParkingSpots);
            pst.setString(9, DaysOpen);
            pst.execute();
            pst.close();
            conn.close();

        } catch (SQLException e) {
            throw new IllegalArgumentException("Error in StoreEntry_Dao");
        }
        return null;
    }

   
}
